<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<%@ include file="/WEB-INF/views/include/header.jsp"%>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
	<form class="form-horizontal m" id="form-cmsCategory-add">
		<input id="treeId" name="parentId" type="hidden" value="${category.catId}"   />

		<div class="row">
			<div class="col-sm-12">
				<div class="form-group">
					<label class="col-sm-2 control-label required_hold"><em class="required_red">*</em>所属栏目</label>
					<div class="col-sm-10">
						<div class="input-group">
							<input class="form-control" type="text" name="parentName" onclick="selectCateTree()" readonly="true" id="treeName">
							<span class="input-group-btn">
								<button type="button" onclick="selectCateTree()" class="btn btn-default">选择</button>
							</span>
						</div>
					</div>
				</div>
			</div>
		</div>

		<div class="row">
			<div class="col-sm-6">
				<div class="form-group">
					<label class="col-sm-4 control-label required_hold"><em class="required_red">*</em>名称 </label>
					<div class="col-sm-8">
						<input id="catName" name="catName" class="form-control" type="text">
					</div>
				</div>
			</div>

			<div class="col-sm-6">
				<div class="form-group">
					<label class="col-sm-4 control-label required_hold"><em class="required_red">*</em>编码 </label>
					<div class="col-sm-8">
						<input id="catEnglish" name="catEnglish" class="form-control" type="text">
					</div>
				</div>
			</div>
		</div>

		<div class="row">
			<div class="col-sm-6">
				<div class="form-group">
					<label class="col-sm-4 control-label required_hold">转向链接</label>
					<div class="col-sm-8">
						<div class="input-group">
							<input type="text" name="catUrl" id="catUrl" maxlength="255" class="form-control"/>
							<span class="input-group-addon">
						<span class="in-prompt" title=""></span>
					</span>
						</div>
					</div>
				</div>
			</div>

			<div class="col-sm-6">
				<div class="form-group">
					<label class="col-sm-4 control-label required_hold">新窗口打开</label>
					<div class="col-sm-8">
						<select class="form-control" name="newWindow">
							<option value="">---默认---</option>
							<option value="true">是</option>
							<option value="false">否</option>
						</select>
					</div>
				</div>
			</div>
		</div>


		<div class="row">
			<div class="col-sm-12">
				<div class="form-group">
					<label class="col-sm-2 control-label required_hold"><em class="required_red">*</em>标题 </label>
					<div class="col-sm-10">
						<input id="title" name="title" class="form-control" type="text">
					</div>
				</div>
			</div>
		</div>

		<div class="row">
			<div class="col-sm-12">
				<div class="form-group">
					<label class="col-sm-2 control-label required_hold"><em class="required_red">*</em>关键词 </label>
					<div class="col-sm-10">
						<input id="keywords" name="keywords" class="form-control" type="text">
					</div>
				</div>
			</div>
		</div>

		<div class="row">
			<div class="col-sm-12">
				<div class="form-group">
					<label class="col-sm-2 control-label required_hold">描述 </label>
					<div class="col-sm-10">
						<textarea id="description" name="description" rows="5" maxlength="450" class="form-control"></textarea>
					</div>
				</div>
			</div>
		</div>

		<div class="row">
			<div class="col-sm-6">
				<div class="form-group">
					<label class="col-sm-4 control-label required_hold"><em class="required_red">*</em>栏目模型 </label>
					<div class="col-sm-8">
						<select id="catModelid" name="catModelid" class="form-control"  >
							<c:forEach items="${fnc:getCmsModelEntityByTypeList('node')}" var="dict">
								<option  value="${dict.modelId}" >${dict.name}</option>
							</c:forEach>
						</select>
					</div>
				</div>
			</div>

			<div class="col-sm-6">
				<div class="form-group">
					<label class="col-sm-4 control-label required_hold">文档模型 </label>
					<div class="col-sm-8">

						<select id="newsModelid" name="newsModelid" class="form-control"  >
							<c:forEach items="${fnc:getCmsModelEntityByTypeList('node')}" var="dict">
								<option  value="${dict.modelId}" >${dict.name}</option>
							</c:forEach>
						</select>
					</div>
				</div>
			</div>
		</div>

		<div class="row">
			<div class="col-sm-6">
				<div class="form-group">
					<label class="col-sm-4 control-label required_hold"><em class="required_red">*</em>栏目模板 </label>
					<div class="col-sm-8">
						<input id="catTemplate" name="catTemplate" class="form-control" type="text">
					</div>
				</div>
			</div>

			<div class="col-sm-6">
				<div class="form-group">
					<label class="col-sm-4 control-label required_hold">文档模板 </label>
					<div class="col-sm-8">
						<input id="newsTemplate" name="newsTemplate" class="form-control" type="text">

					</div>
				</div>
			</div>
		</div>


		<div class="row">
			<div class="col-sm-12">
				<div class="form-group">
					<label class="col-sm-2 control-label required_hold ">栏目页静态化</label>
					<div class="col-sm-10">
						<div class="form-inline">
							<select id="isGenerateNode" name="isGenerateNode" class="form-control"  >
								<option value="">---是否开启---</option>
								<c:forEach items="${fnc:getDictDataByTypeList('sys_yes_no')}" var="dict">
									<option  value="${dict.dictValue}" >${dict.dictLabel}</option>
								</c:forEach>
							</select>

							<div class="input-group">
								<span class="input-group-addon">文件路径</span>
								<input type="text"  id="catPath" name="catPath" value="/{node_number}/index" class="form-control text-right"/>
							</div>
							<select id="catExt" name="catExt" class="form-control"  >
								<option value="">---扩展名---</option>
								<c:forEach items="${fnc:getDictDataByTypeList('cms_catext_html')}" var="dict">
									<option  value="${dict.dictValue}" >${dict.dictLabel}</option>
								</c:forEach>
							</select>

							<select class="form-control" name="isDefPage">
								<option value="">---默认文档---</option>
								<c:forEach items="${fnc:getDictDataByTypeList('sys_yes_no')}" var="dict">
									<option  value="${dict.dictValue}" >${dict.dictLabel}</option>
								</c:forEach>
							</select>
						</div>
					</div>
				</div>
			</div>
		</div>


		<div class="row">
			<div class="col-sm-12">
				<div class="form-group">
					<label class="col-sm-2 control-label required_hold">文档页静态化</label>
					<div class="col-sm-10">
						<div class="form-inline">
							<select id="isGenerateNews" name="isGenerateNews" class="form-control"  >
								<option value="">---是否开启---</option>
								<c:forEach items="${fnc:getDictDataByTypeList('sys_user_sex')}" var="dict">
									<option  value="${dict.dictValue}" >${dict.dictLabel}</option>
								</c:forEach>
							</select>

							<div class="input-group">
								<span class="input-group-addon">文件路径</span>
								<input type="text" id="newsPath" name="newsPath"  value="/{node_number}/{info_id}" class="form-control text-right"/>
							</div>
							<select class="form-control" name="newsExt">
								<option value="">---扩展名---</option>
								<c:forEach items="${fnc:getDictDataByTypeList('cms_catext_html')}" var="dict">
									<option  value="${dict.dictValue}" >${dict.dictLabel}</option>
								</c:forEach>
							</select>
						</div>
					</div>
				</div>
			</div>
		</div>


		<div class="row">
			<div class="col-sm-12">
				<div class="form-group">
					<label class="col-sm-2 control-label required_hold">栏目图 </label>
					<div class="col-sm-10">
						<input id="image" name="image" class="form-control" type="text">
					</div>
				</div>
			</div>
		</div>

		<div class="row">
			<div class="col-sm-6">
				<div class="form-group">
					<label class="col-sm-4 control-label required_hold"><em class="required_red">*</em>小图 </label>
					<div class="col-sm-8">
						<input id="smallImage" name="smallImage" class="form-control" type="text">
					</div>
				</div>
			</div>

			<div class="col-sm-6">
				<div class="form-group">
					<label class="col-sm-4 control-label required_hold">大图 </label>
					<div class="col-sm-8">
						<input id="largeImage" name="largeImage" class="form-control" type="text">
					</div>
				</div>
			</div>
		</div>

		<div class="row">
			<div class="col-sm-6">
				<div class="form-group">
					<%--0、待审核  1、通过 2、未通过：--%>
					<label class="col-sm-4 control-label required_hold"><em class="required_red">*</em>审核状态 </label>
					<div class="col-sm-8">
						<input id="checkStatus" value="0" name="checkStatus" class="form-control" type="text">
					</div>
				</div>
			</div>

			<div class="col-sm-6">
				<div class="form-group">
					<%--0、正常 1、删除 2、禁止：--%>
					<label class="col-sm-4 control-label required_hold">状态 </label>
					<div class="col-sm-8">
						<input id="status" name="status" class="form-control" value="1" type="text">
					</div>
				</div>
			</div>
		</div>

		<div class="row">
			<div class="col-sm-6">
				<div class="form-group">
					<label class="col-sm-4 control-label required_hold"><em class="required_red">*</em>排序 </label>
					<div class="col-sm-8">
						<input id="sort" name="sort" class="form-control" type="text">
					</div>
				</div>
			</div>

			<div class="col-sm-6">
				<div class="form-group">
					<%--0、不显1、显示--%>
					<label class="col-sm-4 control-label required_hold">是否显示 </label>
					<div class="col-sm-8">
						<input id="isShow" name="isShow" class="form-control" type="text">
					</div>
				</div>
			</div>
		</div>

		<div class="row">
			<div class="col-sm-12">
				<div class="form-group">
					<label class="col-sm-2 control-label required_hold">备注 </label>
					<div class="col-sm-10">
						<input id="remark" name="remark" class="form-control" type="text">
					</div>
				</div>
			</div>
		</div>
		<hr/>
		<div class="row">
			<div class="col-sm-12">
				<div class="form-group">
					<div class="col-sm-12" style="text-align: center">
						<button class="btn btn-success" onclick="submitHandler();" type="button" style="width: 90px;">保存</button>
						<button class="btn btn-default" onclick="submitHandler();" type="button" style="width: 90px;">保存并审核</button>
						<button class="btn btn-default" onclick="submitHandler();" type="button" style="width: 90px;">保存并关闭</button>
					</div>
				</div>
			</div>
		</div>


	</form>
</div>
<%@ include file="/WEB-INF/views/include/footer.jsp"%>
<script type="text/javascript">
    var prefix = ctx + "cms/category"
    $("#form-cmsCategory-add").validate({
        rules:{
            catName:{
                required:true,
            },
        }
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/add", $('#form-cmsCategory-add').serialize());
        }
    }

    /*用户管理-新增-选择栏目树*/
    function selectCateTree() {
        var treeId = $("#treeId").val();
        var catId = $.common.isEmpty(treeId) ? "100" : $("#treeId").val();
        var url = ctx + "cms/category/selectCateTree/" + catId;
        var options = {
            title: '选择栏目',
            width: "380",
            url: ctx + "cms/category/selectCateTree/" + catId,
            callBack: doSubmit
        };
        $.modal.openOptions(options);
    }

    function doSubmit(index, layero){
        var tree = layero.find("iframe")[0].contentWindow.$._tree;
        if ($.tree.notAllowParents(tree)) {
            var body = layer.getChildFrame('body', index);
            $("#treeId").val(body.find('#treeId').val());
            $("#treeName").val(body.find('#treeName').val());
            layer.close(index);
        }
    }

</script>
</body>
</html>
